package user;

import book.BookList;
import operation.*;

import java.util.Scanner;

public class NormalUser extends User{
    public NormalUser(String name) {
        super(name);
        iOperations = new IOperation[]{
                new Exit(),
                new Borrow(),
                new Return(),
                new Search()
        };
    }

    @Override
    public int menu() {
        System.out.println("0.Exit");
        System.out.println("1.Borrow");
        System.out.println("2.Return");
        System.out.println("3.Search");
        System.out.print("choice the function：");
        Scanner scanner = new Scanner(System.in);
        int choice = scanner.nextInt();
        return choice;
    }

    @Override
    public void electFunc(int choice, BookList bookList) {
        iOperations[choice].work(bookList);
    }


}
